<template>
    <div class="main">
        <div class="aside">
            <h3>功能树</h3>
            <router-link to="/main/xtdlb">协调单列表</router-link>
            <router-link to="/main/xjxtd">新建协调单</router-link>
        </div>
        <div class="right">
            <div class="header">
                <h4>欢迎回来：{{ adminStore.adminName }}</h4>
                <!-- <h4>欢迎回来：{{ adminStore.adminName.toUpperCase() }}</h4> -->
                <!-- <h4>欢迎回来：{{ adminStore.adminNameToUpper() }}</h4> -->
                <!-- <h4>欢迎回来：{{ adminStore.adminNameToUpper() }}</h4> -->
                <!-- <h4>欢迎回来：{{ adminStore.adminNameToUpper() }}</h4> -->
                <h4>欢迎回来：{{ adminStore.adminNameUpper }}</h4>

                <button @click="logout">退出登录</button>
                <button @click="adminStore.adminAge++">管理员年龄：{{ adminStore.adminAge }}</button>
                <button @click="adminStore.addAge()">管理员年龄：{{ adminStore.adminAge }}</button>
            </div>
            <div class="content">
                <router-view></router-view>
            </div>
        </div>        
    </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useAdminStore } from '../store/admin'

const router  = useRouter()
const adminStore =useAdminStore()
console.log(adminStore.adminAge)        //注意：Pinia提供的Store中的State没有.value属性
// console.log(adminStore.adminAge.value)  //undefined

const logout = ()=>{
    //清除登录痕迹
    sessionStorage.clear()
    router.replace('/login')
}
</script>

<style scoped>
.main {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: 100vh;
}
.aside {
    display: flex;
    flex-direction: column;
    background: var(--cc-theme-color-blue);
    width: 260px;
    color:#fff;
}
.aside a {
    color: #fff;
}
.right {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.header {
    background: var(--cc-theme-color-blue);
    border-left: 1px solid #fff;
    height: 80px;
    color: #fff;
}
.content {
    width: 100%;
    height:100%;
}
</style>